<script>
  import { toasts, removeToast } from '../stores/toastStore';
  import { fly } from 'svelte/transition';
</script>

<div class="toast-container">
  {#each $toasts as toast (toast.id)}
    <div class="toast {toast.type}" transition:fly={{ y: 20, duration: 200 }}>
      {toast.message}
      <button on:click={() => removeToast(toast.id)}>✖</button>
    </div>
  {/each}
</div>

<style>
  .toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
  }

  .toast {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  }

  .toast.info {
    background-color: #007bff;
    color: white;
  }

  .toast.success {
    background-color: #28a745;
    color: white;
  }

  .toast.error {
    background-color: #dc3545;
    color: white;
  }
</style>
